home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2004 October
/
PCWorld_2004-10_cd.bin
/
software
/
temacd
/
sandra
/
san2004.SP2b-9133-Win32-SSO.exe
/
{app}
/
examples
/
mySQL Schema.sql
< prev
next >
Wrap
Text File
|
2004-03-25
|
3KB
|
138 lines
#
# mySQL 3.23+ Schema for Sandra Report
#
# Database is assumed to have been created already.
# No size settings included, please add as required.
#
# Copyright 1995-2004, C. A. Silasi, SiSoftware.
# All Rights Reserved.
#
# Kill all tables
#
DROP TABLE TItem;
DROP TABLE TItemGroup;
DROP TABLE TDevice;
DROP TABLE TClass;
DROP TABLE TModule;
DROP TABLE TReport;
DROP TABLE TIDCount;
#
# Create new tables
#
CREATE TABLE TReport (
ID INT PRIMARY KEY,
ProgramName VARCHAR(255),
ProgramVersion VARCHAR(255),
RegisteredUser VARCHAR(255),
RegisteredCompany VARCHAR(255),
LicenceStatus VARCHAR(255),
LicenceExtra VARCHAR(255),
UserID VARCHAR(255),
HostName VARCHAR(255),
SystemID VARCHAR(255),
WebUserID VARCHAR(255),
RunID VARCHAR(255),
RunDate DATETIME,
Completed BIT NOT NULL
);
CREATE TABLE TModule (
ID INT PRIMARY KEY,
ReportID INT NOT NULL,
Name VARCHAR(255) NOT NULL,
TypeID INT NOT NULL,
HasClass BIT NOT NULL,
HasDevice BIT NOT NULL,
HelpID INT NOT NULL,
CONSTRAINT cnstMRID FOREIGN KEY(ReportID) REFERENCES TReport(ID)
);
CREATE TABLE TClass (
ID INT PRIMARY KEY,
ModuleID INT NOT NULL,
Name VARCHAR(255) NOT NULL,
TypeID INT NOT NULL,
HelpID INT NOT NULL,
CONSTRAINT cnstCMID FOREIGN KEY(ModuleID) REFERENCES TModule(ID)
);
CREATE TABLE TDevice (
ID INT PRIMARY KEY,
ModuleID INT NOT NULL,
ClassID INT,
Name VARCHAR(255) NOT NULL,
TypeID INT NOT NULL,
HelpID INT NOT NULL,
CONSTRAINT cnstDMID FOREIGN KEY(ModuleID) REFERENCES TModule(ID)
);
CREATE TABLE TItemGroup (
ID INT PRIMARY KEY,
ModuleID INT NOT NULL,
ClassID INT,
DeviceID INT,
Name VARCHAR(255) NOT NULL,
TypeID INT NOT NULL,
HelpID INT NOT NULL,
CONSTRAINT cnstGMID FOREIGN KEY(ModuleID) REFERENCES TModule(ID)
);
CREATE TABLE TItem (
ID INT PRIMARY KEY,
ModuleID INT NOT NULL,
GroupID INT,
Name VARCHAR(255) NOT NULL,
DataValue VARCHAR(255),
IconID INT NOT NULL,
TypeID INT NOT NULL,
HelpID INT NOT NULL,
CONSTRAINT cnstIMID FOREIGN KEY(ModuleID) REFERENCES TModule(ID)
);
CREATE TABLE TIDCount (
TableName VARCHAR(10) PRIMARY KEY,
CurrentID INT NOT NULL
);
#
# Set-up keys/indexes
#
CREATE INDEX ndxUserID ON TReport (UserID);
CREATE INDEX ndxSystemID ON TReport (SystemID);
CREATE INDEX ndxWebUserID ON TReport (WebUserID);
CREATE INDEX ndxModuleName ON TModule (Name);
CREATE INDEX ndxItemName ON TItem (Name);
#
# Inserts
#
INSERT INTO TIDCount (TableName, CurrentID) VALUES ('TItem', 1);
INSERT INTO TIDCount (TableName, CurrentID) VALUES ('TItemGroup', 1);
INSERT INTO TIDCount (TableName, CurrentID) VALUES ('TDevice', 1);
INSERT INTO TIDCount (TableName, CurrentID) VALUES ('TClass', 1);
INSERT INTO TIDCount (TableName, CurrentID) VALUES ('TModule', 1);
INSERT INTO TIDCount (TableName, CurrentID) VALUES ('TReport', 1);